package team.sun.sss.dao.hardwork;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;
import team.sun.sss.pojo.hardwork.HwStatistics;

import java.util.List;

@Mapper
@Repository
public interface HwStatisticsDao {
    //1.显示用工统计表
    @Select("select * from hw_state_statistics ")
    List<HwStatistics> getHwStatisticsList();
    //3.添加用工统计
    @Insert("insert into hw_state_statistics(batch_team,labor_unit,labor_recruiters_num) values" +
            "(#{batchTeam},#{laborUnit},#{laborRecruitersNum})")
    int addHwStatistics(String batchTeam,String laborUnit,int laborRecruitersNum);
    //2.修改用工统计表
    @Update("update hw_state_statistics set hw_state_now=hw_state_now+1 where " +
            " labor_unit=#{laborUnit} and batch_team=#{batchTeam} ")
    int updateHwBatch(String batchTeam,String laborUnit);
    //查询本次招聘人数
    @Select("select labor_recruiters_num from hw_state_statistics where " +
            "batch_team=#{batchTeam} and labor_unit=#{laborUnit} ")
    HwStatistics getRecruiters(String batchTeam,String laborUnit );
    //查询当前人数
    @Select("select hw_state_now from hw_state_statistics where " +
            "batch_team=#{batchTeam} and labor_unit=#{laborUnit} ")
    HwStatistics getNowState(String batchTeam,String laborUnit );
}
